function coef = nonround_dct(img, qtable)
%NONROUND_DCT calculates non-round DCT coeffients.
    if size(img,3) ~= 1
        img = rgb2gray(img);
    end
    [M,N] = size(img);
    P = ceil(M / 8)*8;
    Q = ceil(N / 8)*8;
    pad = zeros(P, Q);% padding
    pad(1:M, 1:N) = img;   
    clear img;
    fun = @(block_struct) dct2(block_struct.data) ./ qtable;% DCT
    coef = blockproc(pad - 128,[8 8], fun);
end
